package com.ByteDance.model.vo;

import com.ByteDance.utils.StatusConstant;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

@Data
public class FeedVO {

    /*本次返回的视频中，发布最早的时间，作为下次请求时的latest_time*/
    @Setter(onMethod_ = {@JsonProperty("next_time")})
    private Long nextTime;

    @Setter(onMethod_ = {@JsonProperty("video_list")})
    private Video[] videoList;

    @Setter(onMethod_ = {@JsonProperty("status_code")})
    @ApiModelProperty("状态码，0-成功，其他值-失败")
    private Integer statusCode;

    @Setter(onMethod_ = {@JsonProperty("status_msg")})
    @ApiModelProperty("状态描述")
    private String statusMsg;

    public static FeedVO success(){
        FeedVO feedVO = new FeedVO();
        feedVO.setStatusCode(StatusConstant.StatusEnum.SUCCESS.getCode());
        feedVO.setStatusMsg(StatusConstant.StatusEnum.SUCCESS.getMsg());
        return feedVO;
    }

    public static FeedVO fail(){
        FeedVO feedVO = new FeedVO();
        feedVO.setStatusCode(StatusConstant.StatusEnum.FAIL.getCode());
        feedVO.setStatusMsg(StatusConstant.StatusEnum.FAIL.getMsg());
        return feedVO;
    }

    @Override
    public String toString() {
        return "FeedVO{" +
                "nextTime=" + nextTime +
                ", videoList=" + Arrays.toString(videoList) +
                ", statusCode=" + statusCode +
                ", statusMsg='" + statusMsg + '\'' +
                '}';
    }
}
